#ifndef __MCS__FUNCTION_ARGUMENT_LIST__HPP
#define __MCS__FUNCTION_ARGUMENT_LIST__HPP

#include "Expression.hpp"
#include "FunctionSignature.hpp"

class FunctionArgumentList : public Object
{
public:
	explicit FunctionArgumentList(SourceLocation const & location)
		: Object()
		, location_(location)
	{}

	FunctionArgumentList(SourceLocation const & location, ptr<Expression> a)
		: Object()
		, location_(location)
	{
		addArgument(a);
	}

	FunctionArgumentList(SourceLocation const & location, ptr<Expression> a1, ptr<Expression> a2)
		: Object()
		, location_(location)
	{
		addArgument(a1);
		addArgument(a2);
	}

	void addArgument(ptr<Expression> arg)
	{
		args_.push_back(arg);
	}

	size_t count() const
	{
		return args_.size();
	}
	
	ptr<Expression> arg(size_t i) const
	{
		return args_.at(i);
	}

	void init(Block * parentBlock)
	{
		for(size_t i=0; i<args_.size(); ++i)
		{
			args_.at(i)->init(parentBlock);
		}
	}

	FunctionSignature calcSignature(String	const & funcName)
	{
		FunctionSignature retVal(funcName, args_.size());
		for(size_t i=0; i<args_.size(); ++i)
		{
			retVal.addArgumentType(args_.at(i)->dataType());
		}
		return retVal;
	}
private:
	SourceLocation location_;
	std::vector< ptr<Expression> > args_;
};

#endif //__MCS__FUNCTION_ARGUMENT_LIST__HPP
